/*
 * Copyright (C) 2012 CNL - ECE Dept - National University of Singapore
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
package sg.nus.ece.cnl.veracity.access;

import com.jcraft.jsch.UserInfo;
import java.io.File;
import org.apache.log4j.Logger;

/**
 *
 * @author tram
 */
public class SshUserCredentials implements UserInfo {

    private static final Logger log = Logger.getLogger(SshUserCredentials.class);
    // user login
    private String login;
    // usser password, used in case without ssh key pair
    private String password;
    // ssh key passphrase
    private String passphrase;
    // private key corresponding to this passphrase
    private File privateKey;

    public SshUserCredentials(String login, String password) {
        this.login = login;
        this.password = password;
    }

    public SshUserCredentials(String login, File privateKey, String passphrase) {
        this.login = login;
        this.privateKey = privateKey;
        this.passphrase = passphrase;
    }

    public String getPassphrase() {
        return this.passphrase;
    }

    public String getPassword() {
        return this.password;
    }

    public String getLogin() {
        return this.login;
    }
    
    public File getPrivateKey() {
        return this.privateKey;
    }
    
    public boolean promptPassword(String string) {
        return true;
    }

    public boolean promptPassphrase(String string) {
        return true;
    }

    public boolean promptYesNo(String string) {
        return true;
    }

    public void showMessage(String message) {
        log.info(message);
    }
}
